package com.np.adapter;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.np.dto.KeHoach;
import com.np.moneylover.R;



public class KehoachAdapter extends ArrayAdapter<KeHoach>{

    private Activity context;
	private int layout;
	private List<KeHoach>list;
	public KehoachAdapter(Context context, int textViewResourceId,
			List<KeHoach> objects) {
		super(context, textViewResourceId, objects);
		// TODO Auto-generated constructor stub
		this.context=(Activity) context;
		this.layout=textViewResourceId;
		this.list=objects;
	}
	
    @Override
    public int getCount() {
        return list.size();
    }
     
    @Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater flater=context.getLayoutInflater();
		View row=flater.inflate(layout, parent,false);
		TextView txt1=(TextView) row.findViewById(R.id.lbtengiaodich);
		TextView txt2=(TextView) row.findViewById(R.id.lbsotiengiaodich);
		///TextView txt3=(TextView) row.findViewById(R.id.viewmotalm);
		
		KeHoach data=list.get(position);
		txt1.setText(data.getTenKH());
		
		
		
			
			
		
		
		//if(position==0)
		//{
		//	row.setBackgroundColor(Color.RED);
		//}
		return row;
	}
}
